import re
from coin.exchange.base.kr_rest.currency import NativeCurrency, NormCurrency


class SharedCurrency(NativeCurrency):
  _exchange = "Shared"
  _regex = re.compile('^[\w-]+$')

  def __init__(self, currency, native_currency):
    assert type(native_currency) == str
    assert currency.upper() == currency
    assert len(currency) > 0
    assert len(native_currency) > 0
    assert self._regex.match(currency) is not None
    super().__init__(currency, native_currency)

  @classmethod
  def FromStrCurrencyImpl(cls, currency, current_datetime):
    return cls(currency, currency)

  @classmethod
  def FromStrNativeCurrencyImpl(cls, currency, current_datetime):
    return cls(currency, currency)
